import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MemberAttendanceGroupVO, MemberAttendanceGroupForm, MemberAttendanceGroupQuery } from '@/api/dormitory/memberAttendanceGroup/types';

/**
 * 查询宿舍学生考勤分组关系列表
 * @param query
 * @returns {*}
 */

export const listMemberAttendanceGroup = (query?: MemberAttendanceGroupQuery): AxiosPromise<MemberAttendanceGroupVO[]> => {
  return request({
    url: '/dormitory/memberAttendanceGroup/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询宿舍学生考勤分组关系详细
 * @param id
 */
export const getMemberAttendanceGroup = (id: string | number): AxiosPromise<MemberAttendanceGroupVO> => {
  return request({
    url: '/dormitory/memberAttendanceGroup/' + id,
    method: 'get'
  });
};

/**
 * 新增宿舍学生考勤分组关系
 * @param data
 */
export const addMemberAttendanceGroup = (data: MemberAttendanceGroupForm) => {
  return request({
    url: '/dormitory/memberAttendanceGroup',
    method: 'post',
    data: data
  });
};

/**
 * 修改宿舍学生考勤分组关系
 * @param data
 */
export const updateMemberAttendanceGroup = (data: MemberAttendanceGroupForm) => {
  return request({
    url: '/dormitory/memberAttendanceGroup',
    method: 'put',
    data: data
  });
};

/**
 * 删除宿舍学生考勤分组关系
 * @param id
 */
export const delMemberAttendanceGroup = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dormitory/memberAttendanceGroup/' + id,
    method: 'delete'
  });
};
